<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>文章评论列表</title>
    <link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap/dist/css/bootstrap.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/animate.css/animate.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/font-awesome/css/font-awesome.min.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/simple-line-icons/css/simple-line-icons.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/bootstrap-editable/css/bootstrap-editable.min.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/app/css/font.css" type="text/css" />
    <link rel="stylesheet" href="__ADMIN_STATICS__/app/css/app.css" type="text/css" />
</head>
<body>
<div class="wrapper-md">
    <div class="panel panel-default">
        <div class="panel-heading">
            <div class="row">
                <div class="col-sm-3">
                    <a href="{:U('Admin/Index/welcome')}"><i class="fa fa-home"></i>&nbsp;首页&nbsp;</a>&gt;&nbsp;&nbsp;文章评论列表
                </div>
            </div>
        </div>
        <div class="panel-body">
            <form action="{:U('Admin/ArticleComment/index')}" method="get">
                内容：<input type="text" name="keyword" value="{$Think.get.keyword}" class="form-control input-sm w-sm inline m-r v-middle"/>
                <button type="submit" class="btn btn-sm btn-default">搜索</button>
                 <span class="pull-right">
                    <button type="button" class="btn btn-danger btn-sm menu-add" onclick="javascript:if(confirm('确定删除选中项？'))batchDelete()">删除选中</button>
                </span>
            </form>
        </div>
        <div class="table-responsive">
            <table class="table table-bordered table-striped table-hover table-condensed b-t b-light">
                <thead>
                    <tr>
                        <th>文章标题</th>
                        <th>文章评论</th>
                        <th width="70">审核</th>
                        <th width="120">添加时间</th>
                        <th width="120">操作</th>
                        <th width="10">
                            <label class="i-checks">
                                <input type="checkbox" onclick="$('input[name*=\'delids\']').prop('checked', this.checked);">
                                <i></i>
                            </label>
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <volist name="assign.data" id="v">
                        <tr>
                            <td>{$v['article']}</td>
                            <td>{$v['content']}</td>
                            <td class="text-center" data-id="{$v['id']}" onclick="edit(this)">
                                <a href="javascript:void(0);" class="{$v['status'] == 1 ? 'active' : ''}"><i class="fa fa-check text-success text-active"></i><i class="fa fa-times text-danger text"></i></a>
                            </td>
                            <td>{$v['create_time'] | date="Y-m-d",###}</td>
                            <td>
                                <a class="btn btn-danger btn-xs" href="javascript:if(confirm('确定删除？'))location='{:U('Admin/ArticleComment/delete',array('id'=>$v['id']))}'">删除</a>
                            </td>
                            <td>
                                <label class="i-checks">
                                    <input type="checkbox" name="delids" value="{$v['id']}">
                                    <i></i>
                                </label>
                            </td>
                        </tr>
                    </volist>
                </tbody>
            </table>
        </div>
        <footer class="panel-footer">
            <div class="row text-center">
            {$assign.page}
            </div>
        </footer>
     </div>
</div>
<script src="__ADMIN_STATICS__/jquery/jquery.min.js"></script>
<script src="__ADMIN_STATICS__/bootstrap/dist/js/bootstrap.js"></script>
<script type="text/javascript">
function edit(obj) {
    var id = $(obj).attr('data-id');
    var a = $(obj).find('a');
    var param = 0;
    if(a.hasClass('active')){
        param = 0;
    }else{
        param = 1;
    }
    $.ajax({
        url : "{:U('Admin/ArticleComment/editAjax')}",
        data : {id : id, param : param},
        dataType : "json",
        type : "post",
        success:function(data){
            if(data.code){
                a.toggleClass('active');
            }
        }
    });
}

function batchDelete(){
    var ids = [];
    $("input[name='delids']").each(function(){
        if ($(this).is(':checked') == true){
            var id = $(this).val();
            ids.push(id);
        }
    });
    if(ids.length > 0){
        location.href="/index.php?m=Admin&c=articleComment&a=batchDelete&ids="+ids;
    }else{
        alert('请选择要删除的文章评论');
    }
}   
</script>
</body>
</html>
